import java.util.HashSet;
import java.util.Locale;
import java.util.Scanner;
import java.util.Set;

public class BadKey {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String ex = null;
        String ac = null;
        while (scanner.hasNextLine()){
            ex = scanner.nextLine();
            ac = scanner.nextLine();
        }
        ex = ex.toUpperCase();
        ac = ac.toUpperCase();
        Set<Character> set1 = new HashSet<>();
        for (int i = 0; i < ac.length(); i++) {
            set1.add(ac.charAt(i));
        }
        Set<Character> set2 = new HashSet<>();
        for (int i = 0; i < ex.length(); i++) {
            if(!set1.contains(ex.charAt(i))){
                if(set2.add(ex.charAt(i))){
                    System.out.print(ex.charAt(i));
                }
            }
        }
    }
}
